<template>
    <div class="title">
      <el-row>
        <el-col :span="12">
          <div class="text">
            {{ title }}
          </div>
        </el-col>
        <el-col :span="12" class="right" v-if="addUrl">
          <router-link :to="addUrl" class="el-button el-button--primary">添加</router-link>
        </el-col>  
      </el-row>
    </div>
</template>

<script>
  export default {
    name: 'PageTitle',
    props: {
      title: {
        required: true,
        type: String
      },
      addUrl: String
    }
  }
</script>

<style lang="scss" scoped>
  .title {
    padding: 18px 20px;
    .text {
      height: 40px;
      line-height: 40px;
    }
    .right {
      text-align: right;
    }
  }
</style>
